using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using JGSY.CMS.LowCode.Platform.Application.DTOs;

namespace JGSY.CMS.LowCode.Platform.Application.Interfaces
{
    /// <summary>
    /// 配置服务接口。
    /// 提供系统配置的读取、设置、分组管理等配置相关底层服务功能接口定义。
    /// </summary>
    public interface IConfigService
    {
        /// <summary>
        /// 获取配置值
        /// </summary>
        /// <param name="key">配置键</param>
        /// <returns>配置值</returns>
        Task<string?> GetValueAsync(string key);
        
        /// <summary>
        /// 获取配置组
        /// </summary>
        /// <param name="category">配置分类</param>
        /// <returns>配置键值对集合</returns>
        Task<IDictionary<string, string>> GetGroupAsync(string category);
        
        /// <summary>
        /// 设置配置值
        /// </summary>
        /// <param name="key">配置键</param>
        /// <param name="value">配置值</param>
        /// <param name="category">配置分类</param>
        /// <param name="description">配置描述</param>
        /// <param name="isEnabled">是否启用</param>
        /// <returns>设置任务</returns>
        Task SetValueAsync(string key, string value, string category = "", string description = "", bool isEnabled = true);
        
        /// <summary>
        /// 刷新配置缓存
        /// </summary>
        /// <returns>刷新任务</returns>
        Task RefreshAsync();
        
        /// <summary>
        /// 获取所有系统配置
        /// </summary>
        /// <returns>系统配置列表</returns>
        Task<IEnumerable<SystemSettingDto>> GetAllAsync();
    }
}
